主题
查询进程是否在黑名单中 - ProtectFileQueryBlacklist
函数简介
查询进程是否在黑名单中。(高级版功能,普通版无法使用)
接口名称
ProtectFileQueryBlacklistDLL调用
c
int32_t ProtectFileQueryBlacklist(int64_t instance, int64_t pid);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| pid | 长整数型 | 进程ID。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.ProtectFileQueryBlacklist(1234);csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.ProtectFileQueryBlacklist(1234);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.ProtectFileQueryBlacklist(1234)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.ProtectFileQueryBlacklist(1234);go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
ret := ola.ProtectFileQueryBlacklist(1234)rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let ret = ola.protect_file_query_blacklist(1234);cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.ProtectFileQueryBlacklist(1234)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.ProtectFileQueryBlacklist(1234)text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.ProtectFileQueryBlacklist(1234)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.ProtectFileQueryBlacklist(1234);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.ProtectFileQueryBlacklist(1234)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ret = ola.ProtectFileQueryBlacklist(1234);原生 DLL 调用
cpp
ProtectFileQueryBlacklist(instance, 1234);csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int ProtectFileQueryBlacklist(long ola, int pid);
ProtectFileQueryBlacklist(instance, 1234);python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.ProtectFileQueryBlacklist(instance, 1234)返回值
本接口为查询类:通讯成功时用 1/0 表示业务结果;仅驱动通讯失败时返回错误码。
错误码去哪里读
| 方式 | 说明 |
|---|---|
本接口返回值 ret | ret != 0 && ret != 1 时,ret 即为错误码。 |
GetLastError / GetLastError() | 读取最后一次错误码。 |
| GetLastErrorString | 读取中文说明;用完后须 FreeStringPtr 释放。 |
| 驱动错误码说明 - DriverErrorCodes | 十进制 / 十六进制完整对照表。 |
| 返回值 | 说明 |
|---|---|
1 | 查询成功,结果为「是」(在名单中 / 路径受保护)。 |
0 | 查询成功,结果为「否」;或参数无效。 |
| 其他 | 驱动通讯失败时的错误码,见上方「错误码去哪里读」。 |
TIP
仅当 ret 既不是 0 也不是 1 时,才按驱动错误码表排查。
注意事项
| 项目 | 说明 |
|---|---|
| 管理员权限 | 须以 管理员权限 运行;内置欧拉驱动会自动加载,无需手动 LoadDriver。自签名驱动需先 ImportDriverFromFile 或 ImportDriver。 |
